<template>
<div class="share">
  <img src="../../assets/GZH/1001.jpg" alt="">
  <img src="../../assets/GZH/1002.jpg" alt="">
  <img src="../../assets/GZH/1003.jpeg" alt="">
  <img src="../../assets/GZH/1004.jpeg" alt="">
  <img src="../../assets/GZH/1005.jpeg" alt="">
  <img src="../../assets/GZH/1006.jpeg" alt="">
  <img src="../../assets/GZH/1007.jpeg" alt="">
  <img src="../../assets/GZH/1008.png" alt="">
  <player :video-url="videoUrl" :state="state"></player>
  <div class="footer">
    <div class="footer-left">
      <p class="tit">九银锂电车</p>
      <p class="address">活动地点：{{near_detailsData.isActivityAddress?near_detailsData.activityAddress:near_detailsData.shopAddress}}</p>
      <p class="tel">联系方式：{{near_detailsData.isActivityAddress?near_detailsData.activityPhone:near_detailsData.shopPhone}}</p>
    </div>
    <img class="footer-right" src="../../assets/GZH/QRcode-img.png" alt="">
  </div>
</div>
</template>
<script>
import { Toast } from 'vant';
import player from  './video'
import weixin from './wxConfig.js'
export default {
  components:{
    player,
  },
  data(){
    return{
      videoUrl:'http://h5-jike.6glz.com/upload/web/1568100062453117.mp4',
      state:false,
      shopId:'',
      activityId:'',
      near_detailsData:'',
      shareImg:require('../../assets/GZH/share-ico.png'),
    }
  },
  watch: {
videoUrl: function (val) {
  // const myPlayer = this.$refs.videoPlayer.player
  if (val !== '') {
    this.$refs.videoPlayer.player.src(val)
  }
  },
  state: function (val) {
    if (val) {
      this.$refs.videoPlayer.player.pause()
    }
  }
},
  mounted(){
    _hmt.push(['_trackPageview', '/share']);
    this.getWeixincofig()
    let _this = this;
    this.shopId = this.$util.getUrlKey('shopId');
    this.activityId = this.$util.getUrlKey('activityId');
    this.near_details();
    let root = process.env.VUE_APP_MAIN;
    setTimeout(() => {
      console.log('分享')
      console.log(weixin.wxShare)
      console.log(location.href.split('?')[0]+'activities/share/index.html?shopId='+this.shopId+'&activityId='+this.activityId)
      console.log(root+ _this.shareImg)
      weixin.wxShare({
        title:'想免费领一辆九银KING吗？超级试骑真的很赞！',
        desc:'抢免单大奖，赢现金红包，百分百中奖，我在现场，大家快来试骑吧！',
        link:location.href.split('?')[0]+'/activities/share/index.html?shopId='+this.shopId+'&activityId='+this.activityId,
        imgUrl:root+ _this.shareImg,
      })
    }, 1000);
  },
  methods:{
        // 获取微信配置
    getWeixincofig(){
      let url = escape(location.href.split("#")[0]);
      // let url = 'http://sunjinxiang.wicp.vip/#/testDrive';
      this.$api.get("/wx/v1/jsapi_sigin?url=" + url,{},s => {
        console.log(s);
        let data = s.module;
        weixin.wxConfig(data);
      },f => {

      },{
        "Content-Type": "application/x-www-form-urlencoded",
        Accept: "*/*"
      });
    },
    detialPlayVideo(){
      console.log(111)
    },
    closePlay(){
      console.log(123)
    },
    near_details(){
      let _this = this;
      this.$api.get('/exprience/v1/shop_activity_info?shopId='+this.shopId+'&activityId='+this.activityId,{
      },s=>{
        console.log(s)
        _this.near_detailsData = s.module;

      },f=>{
          Toast(f.errorMessage);
      },{
        'Content-Type': 'application/x-www-form-urlencoded',
        'Accept': "*/*"
      })
    }
  }
}
</script>
<style>
body, html {
    width:100%;
    height:auto;
}
</style>

<style scoped lang="scss">
.share{
  width:100%;
}
img{
  width:100%;
}
.footer{
  display: flex;
  flex-direction: row;
  justify-content:space-between;
  align-items: center;
  width:100%;
  min-height:105px;
  padding:10px 0;
  background: #141517;
}
.footer-left{
  flex:1;
  min-height:50px;
  margin-left:20px;
  font-size:12px;
  text-align: left;
}
.tit{
  font-size:16px;
  line-height:24px;
  color:#fff;
}
.address,.tel{
    font-size:12px;
  line-height:20px;
  color:#999;
}
.footer-right{
  width:70px;
  height:70px;
  margin-right:20px;
}
</style>